home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1995 #5 & #6 / Amiga Plus CD - 1995 - No. 5 and 6.iso / pd / daten / ispell / interfaces / shell / lookup.rexx < prev    next >
OS/2 REXX Batch file  |  1992-09-27  |  996b  |  44 lines

  1. /*rx
  2.  *  Lookup.rexx --- program to lookup a regular expression using the
  3.  *  ISpell server from CLI.
  4.  *
  5.  *  Copyright © 1990, 1992  Loren J. Rittle
  6.  *  Use as you will, just document your changes and keep my copyright
  7.  *  notice intact.  Feel free to mail enhancements to me.
  8.  *
  9.  *  Loren J. Rittle
  10.  *  rittle@comm.mot.com
  11.  *  Sun Sep 27 11:30:46 1992
  12.  */
  13.  
  14. options results
  15.  
  16. if left(address(), 4) ~== 'WSH_' then
  17.   address command
  18.  
  19. if words(arg(1)) = 0 then
  20.   do
  21.     say "Usage: lookup word1 word2 ..."
  22.     exit 5
  23.   end
  24.  
  25. if ~show(ports, 'IRexxSpell') then
  26.   do
  27.     'run <nil: >nil: ispell -r >nil: <nil:'
  28.     waitforport 'IRexxSpell'
  29.   end
  30.  
  31. do i = 1 to words(arg(1))
  32.   item = word(arg(1),i)
  33.   address 'IRexxSpell' lookup item
  34.   r = result
  35.   r1 = substr(r,1,1)
  36.   select
  37.     when r1 = '&' then
  38.       say "The pattern '"||item||"' matches:" translate(substr(r,3), "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ")
  39.     otherwise say "For the pattern '"||item||"' I got" r
  40.   end
  41. end
  42.  
  43. exit 0
  44.